#pragma once
#include "instrumentfactory.h"

#include <map>
#include <string>
#include <vector>
#include "AdditiveInstrument.h"
#include "SineWave.h"

class CAdditiveFactory :
	public CInstrumentFactory
{
public:
	CAdditiveFactory(void);
	virtual ~CAdditiveFactory(void);

	CAdditiveInstrument *CreateInstrument();
	void GenWave(std::wstring note);

	double GetSampleRate() const { return mSampleRate; }
	double *GetWave(std::wstring note);

	void SetNote(CNote *aNote);
	void SetAmps(std::vector<double> aAmps) { mAmps = aAmps; }
	void SetAmp(int aIndex, double aAmp) { mAmps[aIndex] = aAmp; }
	void SetSampleRate(double aSampleRate) { mSampleRate = aSampleRate; }

private:
	std::map< std::wstring, std::vector<double> > mWaveTable;
	std::map< std::wstring, std::vector<double> > mPrevTable;
	std::vector<double> mAmps;

	std::wstring mNote;
	double mSampleRate;

	CSineWave mSineWave;
};

